package service

import (
	"guard/internal/app/admin/models"
	"guard/internal/app/admin/store"
	"guard/internal/tool"
)

type AdminService interface {

	/**
	client管理
	*/

	ClientPage(current, size int) (*tool.Paginator, error)
	QueryClient(condition string) (mc []models.ClientDto, err error)
	AddClient(info *models.ClientInfo) error
	RemoveClient(id string) error

	/**
	scope管理
	*/

	ScopeAll() ([]models.AuthorityScope, error)
	ScopePage(current, size int) (*tool.Paginator, error)
	QueryScope(condition string) (mas []models.AuthorityScope, err error)
	AddScope(asInfo *models.AuthorityScope) error
	RemoveScope(tag string) error

	ClientUserApp
}

type adminServiceImpl struct {
	st store.AdminStore
}

func NewClientService(s store.AdminStore) AdminService {
	return &adminServiceImpl{
		st: s,
	}
}

// ClientUserApp 用户客户端App操作
type ClientUserApp interface {
	RegisterClient(username string, info *models.ClientInfo) error
	UserAppAll(username string) (mu []models.UserApp, err error)
	RemoveUserApp(username, cid string) error
}
